.TH plcwait 1 "November 2013" "open-plc-utils-0.0.3" "Qualcomm Atheros Open Powerline Toolkit"

.SH NAME
ampwait - Qualcomm Atheros Powerline Procrastinator

.SH SYNOPSIS
.BR ampwait
.RI [ options ] 
.RI [ device ] 
.RI [ device ] 
[...]

.SH DESCRIPTION
Poll a Qualcomm Atheros powerline device, waiting for one or more events to occur before continuing or returning.
The events include reset or power off, restart or power on and network association.
It is used to pause shell scripts at critical points where a device must be in a known state before continuing.

.P
This program is part of the Qualcomm Atheros Powerline Toolkit.
See the \fBplc\fR man page for an overview and installation instructions.

.SH OPTIONS

.TP
-\fBa\fR
Poll the device every few seconds using VS_NW_INFO messages until the device indicates that a networks exists and has at least one station.
This option can give false readings if other devices have dropped off-line and the device bridging table still holds information about them.
The program always checks for this event last if other event options are specified.

.TP
.RB - e
Redirects stderr messages to stdout.
By convention status and error messages are printed on stderr while primary program output is printed on stdout.
This option prints all output on stdout in cases where this is desired.

.TP
-\fBf \fIfirmware\fR
The identification string for firmware that should be running after the device starts.
This option can be used to detect a failed firmware load.
If the actual identification string does not match this one once the device starts then an error is reported.
If option -\fBx\fR is present then the program terminates with a non-zero exit code.
This option has no effect unless option -\fBs\fR is present.
An identification string looks like "INT6000-MAC-3-1-3143-1690-20071107-FINAL-B" and can be obtained using \fBint6k -r\fB.

.TP
-\fBi\fR
Select the host Ethernet interface.
All requests are sent via this host interface and only reponses received via this host interface are recognized.
The default interface is \fBeth1\fR because most people use \fBeth0\fR as their principle network connection; however, if environment string "PLC" is defined then it takes precedence over the default interface.
This option then takes precedence over either default.

.TP
-\fBp \fIseconds\fR
Fixed pause time in seconds.
This adds an fixed delay after the other events have occured.
A pause does not occur if any of the specified events timeout.
When no other events are specified this option is effectively equivalent to \fBsleep\fR.
This option can be used to allow the device or the network to settle.
For example, a nominal 5 second wait is recommended after a device successfully associates before attempting to transfer data.

.TP
.RB - q
Enter quiet mode.
Progress messages are suppressed.

.TP
.RB - R
Reset the device then check return status.
Exit program on error if option \fB-x\fR is present; otherwise, repeat the reset request until the device either accepts the request or the wait time is exceeded.

.TP
-\fBs\fR
Poll the device every few seconds using VS_SW_VER messages until the bootloader or runtime firmware responds or the poll count exhausts.
The presence of a response indicates that the device has either connected to the host, received power or finished reboot.

.TP
-\fBt \fImilliseconds\fR
Channel read/write timeout in milliseconds.
This is the maximum time allowed for a confirmation or a response from a powerline device before abandoning a read/write operation.
Permitted values range from \fB0\fR through \fBUINT_MAX\fR as defined in \fBlimits.h\fR.
The default is \fB50\fR milliseconds.

.TP
.RB - v
Enter verbose mode.
All Etherenet frames sent or received by the program are displayed on stdout.

.TP
-\fBw \fIseconds\fR
Wait timeout in seconds.
This is the maximum time that this application will wait for an event to occur where an event is \fBreset\fR, \fBstart\fR or \fBassoc\fR.
If an event does no occur within this time, the program proceeds to wait for the next specified event.
This timeout applies to each event in turn when more than one event is specified.
Permitted values are \fB0\fR through \fB86400\fR seconds which is 24 hours.

.TP
-\fBx\fR
Exit program on first error with a non-zero exit code.
This option allows shell scripts to detect failed or incomplete operations and take the appropriate action.

.TP
.RB - y
Display actual wait times on stdout.

.TP
-\fB?\fR, --\fBhelp\fR
Print program help summary on stdout.
This option takes precedence over other options on the command line.

.TP
-\fB!\fR, --\fBversion\fR
Print program version information on stdout.
This option takes precedence over other options on the command line.
Use this option when sending screen dumps to Atheros Technical Support so that they know exactly which version of the Linux Toolkit you are using.

.SH ARGUMENTS

.TP
\fIdevice\fR
The Media Access Control (MAC) address of some device.
Addresses are 6 hexadecimal octets optionally separated by colon.
For example, the addresses "00b052000001", "00:b0:52:00:00:01" and "00b052:000001" are all valid and equivalent.
For convenience, the symbolic address "\fBlocal\fR" resolves to "00:b0:52:00:00:01" and the symbolic addresses "\fBall\fR" and "\fBbroadcast\fR" both resolve to "ff:ff:ff:ff:ff:ff".

.SH REFERENCES
See the Qualcomm Atheros HomePlug AV Firmware Technical Reference Manual for more information.

.SH DISCLAIMER
Atheros HomePlug AV Vendor Specific Management Message Entry structure and content is proprietary to Qualcomm Atheros, Ocala FL USA.
Consequently, public information may not be available.
Qualcomm Atheros reserves the right to modify message structure and content in future firmware releases without any obligation to notify or compensate users of this program.

.SH EXAMPLES
The following command polls the local device until firmware stops running then polls the device until firmware starts running again.
This command can be inserted into a shell script at a point where the device must reset and reboot before proceeding.
Observe that the program waits up to \fB60\fR seconds for each event, in turn, because \fB60\fR seconds is the default wait period.
If an event occurs before the specified timeout the program will move on to the next event.

.PP
   # ampwait -rs
   eth0 00:B0:52:BA:BA:01 Allow 60 seconds for Reset
   eth0 00:B0:52:BA:BA:01 Allow 60 seconds for Start

.PP
The following example waits up to \fB30\fR seconds for the local device to reset (\fB-r\fR) then up to 50 seconds for the local device to start (\fB-s\fR).
This is the same as above but we have specified \fB30\fR seconds using option \fB-w\fR.

.PP
   # ampwait -r -s -w 30      
   eth0 00:B0:52:BA:BA:01 Allow 30 seconds for Reset
   eth0 00:B0:52:BA:BA:01 Allow 30 seconds for Start

.PP
The next example reports the actual amount of time taken for each event to occur.
Observe that the last event, device association, did not occur within the allotted time.

.PP
   # ampwait -rsay
   eth0 00:B0:52:BA:BA:01 Allow 60 seconds for Reset
   etho 00:B0:52:BA:BA:01 Waited 22 seconds to Reset
   eth0 00:B0:52:BA:BA:01 Allow 60 seconds for Start
   etho 00:B0:52:BA:BA:01 Waited 4 seconds to Start
   eth0 00:B0:52:BA:BA:01 Allow 60 seconds for Assoc
   etho 00:B0:52:BA:BA:01 Waited 60 seconds for Assoc
   etho 00:B0:52:BA:BA:01 Device did not Assoc 

.PP
The following example illustrates use of the revision string to detect mismatched firmware.
In this example, we reset the device first, using program \fBamptool\fR, then wait for it to reset then start up again.
There are also operation that can cause the device to reset.

.PP
   # amptool -R
   # ampwait -xrsf INT6000-MAC-3-1-3143-1690-20071107-FINAL-B
   eth0 00:B0:52:BA:BA:01 Device started wrong firmware

.PP
Immediately after a reset we wait for the firmware to stop responding, with option -\fBr\fR, and then start responding, with option -\fBs\fR, and then perform a string comparison against the actual firmware revision string, with option -\fBf\fR.
If the strings do not match then an error is reported.
In this case, the program will exit with a non-zero return code since option -\fBx\fR is present.

.SH DISCLAIMER
Atheros HomePlug AV Vendor Specific Management Message Entry structure and content is proprietary to Qualcomm Atheros, Ocala FL USA.
Consequently, public information may not be available.
Qualcomm Atheros reserves the right to modify message structure and content in future firmware releases without any obligation to notify or compensate users of this program.

.SH SEE ALSO
.BR amp ( 1 ),
.BR amptool ( 1 ),
.BR amphost ( 1 ),
.BR amprate ( 1 ),
.BR ampid ( 1 ),
.BR ampstat ( 1 )

.SH CREDITS
 Charles Maier

